
<?php require_once("../include/conn.php");


if(!empty($_REQUEST["name"])){
$name=$_REQUEST["name"];
}
if($name==3)
{
$cname="动态信息";
}
else if($name==4)
{
$cname="任务指标";
}

$sql_pic="select * from `bl_info`  where name=$name ";
$cn_pic=mysql_db_query($db_name,$sql_pic);
$row_pic = mysql_fetch_row($cn_pic);

?>
<HTML> 
<HEAD> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<TITLE>图片管理</TITLE> 
<style type="text/css"> 
<!-- 
.white12 { font-size: 12pt; color: #FFFFFF; text-decoration: none} 
.blue10 { font-size: 10pt; color: #99CCFF; text-decoration: none} 
.black10 { font-size: 10pt; text-decoration: none} 
.unnamed1 {
	font-size: 12px;
}
--> 
</style> 
</HEAD> 
<BODY BGCOLOR="#FFFFFF"> 
<?php 
if ($upload){ //如果点击"上传"，则执行此php代码部分 
if ($picurl=="none"){ 
echo "你没有上传任何文件."; 
exit; //如果没有上传文件，则退出程序 
} 

 $up=copy("$picurl","../images/$picurl_name"); //关键一步，将临时文件复制到image目录下 
if($up==1) 
{ 

$sql_up="UPDATE `bl_info` SET `pic` = '$picurl_name' WHERE `name` = '$name'";
$cn_up = mysql_db_query($db_name,$sql_up);


 echo "文件上传成功!<BR>"; 
unlink ($picurl); //从临时文件夹中删除档案$picurl 
} 
else 
{echo "文件上传失败."; exit;} //若上传失败，则退出程序 
} 
?> 
<table width="350" border="0" align="center" cellpadding="0" cellspacing="6" class="unnamed1"> 
<tr>
  <td class="black10">确认上传为图片格式：.jpg，.gif，.png，.bmp等。</td>
</tr>
<tr>
  <td class="black10">为了保证图片效果,请上传大小为128像素 X 128像素</td>
</tr>
<tr>
  <td class="black10">图片名:<?php echo $row_pic[2]; ?></td>
</tr>
<tr> 
<td width="316" class="black10"><img src="../images/<?php echo $row_pic[2]; ?>" width="128" height="128"> 
</td> 
</tr> 
<tr bgcolor="#6699FF"> 
<td> 
<div align="center" class="white12"><?php echo $cname ?>修改图片</div> 
</td> 
</tr> 
<tr> 
<td> 
<form action="" method="post" enctype="multipart/form-data" name="UL"> 
<!--注意：这里必须加上'enctype="multipart/form-data" ’，否则不会产生上 
传动作--> 
<div align="center" class="black10">图片文件： 
<input type="file" name="picurl" size="15" accept="image/x-png,image/gif,image/jpeg"> 

<input type="Submit" name="upload" value="上传"> 
<input type="reset" name="Reset" value="重来"> 
</div> 
</form> 
<div align="center" class="blue10"><a href="../" target="_blank"> 观看效果</a></div> 
</td> 
</tr> 
</table> 
</BODY> 
</HTML> 